package cn.edu.gzgs.mapper;

import cn.edu.gzgs.entity.UserPosition;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 用户-岗位关联Mapper
 * @author Zyf
 */
@Mapper
public interface UserPositionMapper extends BaseMapper<UserPosition> {

    /**
     * 批量插入用户岗位关联记录
     *
     * @param userPositionList 用户岗位关联列表
     */
    @Insert("""
            <script>
                INSERT INTO user_position (user_id, position_id) VALUES
                <foreach collection="userPositionList" item="item" separator=",">
                    (#{item.userId}, #{item.positionId})
                </foreach>
            </script>
            """)
    void batchInsert(@Param("userPositionList") List<UserPosition> userPositionList);
} 